import React, {useState} from 'react'

function Input(props) {
    let {
        todoVal,
        changeTodo,
        submitTodo
    } = props;
    
    let submit = (e) => {
        if(e.keyCode === 13) {
            submitTodo()
        }
    }
    return (
        <div>
            <input type="text" value={todoVal} onChange={changeTodo} onKeyDown={submit}/>
        </div>
    ) 
}

export default Input